from tortoise import fields

from app.models.mixins import BaseModel
from app.schemas.enums import WeatherEnum


class WeatherForecast(BaseModel):
    id = fields.BigIntField(pk=True)
    region = fields.ForeignKeyField(
        "models.Region", related_name="forecasts", on_delete=fields.CASCADE
    )
    dateTime = fields.DatetimeField()
    temperature = fields.FloatField()
    weatherCondition = fields.CharEnumField(WeatherEnum)
    weather = fields.ForeignKeyField(
        "models.Weather", related_name="weather_forecasts", null=True
    )

    class Meta:
        table = "weather_forecast"
